package com.tedu.spring.di;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class UserDao {
    /*
    Value注解添加位置：
    1.添加在属性上;
    2.添加在set方法上;
     */
    @Value("jdbc:mysql://localhost:3306/tedu")
    private String dbUrl;
    @Value("root")
    private String username;

    private String password;

    @Value("root")
    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserDao [dbUrl=" + dbUrl + ", username=" + username
                + ", password=" + password + "]";
    }
}
